<template>
  <a-layout-content class="contact-panel">
    <a-layout-header class="contact-header">
      <span class="contact-title">{{ chatInfo.nickname }}</span>
    </a-layout-header>

    <div class="contact-info">
      <div class="info-header">
        <a-avatar :size="64" :src="chatInfo.avatar" />
        <h2>{{ chatInfo.nickname }}</h2>
      </div>

      <div class="info-content">
        <div class="info-item">
          <span class="label">备注</span>
          <span class="value">{{ chatInfo.remark }}</span>
        </div>
        <div class="info-item">
          <span class="label">分组</span>
          <span class="value">{{ chatInfo.category }}</span>
        </div>
        <div class="info-item">
          <span class="label">用户名</span>
          <span class="value">{{ chatInfo.username }}</span>
        </div>
      </div>

      <div class="action-buttons">
        <a-button type="primary" @click="$emit('startChat')">发消息</a-button>
      </div>
    </div>
  </a-layout-content>
</template>

<script lang="ts" setup>
import { defineProps, defineEmits } from "vue";
import { Contact } from "@/types/contact";

defineProps<{
  chatInfo: Contact;
}>();

defineEmits<{
  (e: "startChat"): void;
}>();
</script>

<style scoped>
.contact-panel {
  display: flex;
  flex-direction: column;
  background: #fff;
  height: 100%;
}

.contact-header {
  height: 64px;
  line-height: 64px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}

.contact-title {
  font-size: 16px;
  font-weight: 500;
}

.contact-info {
  padding: 24px;
}

.info-header {
  text-align: center;
  margin-bottom: 24px;
}

.info-header h2 {
  margin-top: 12px;
  color: #333;
}

.info-content {
  background: #f5f5f5;
  padding: 16px;
  border-radius: 8px;
}

.info-item {
  display: flex;
  margin-bottom: 16px;
}

.info-item .label {
  width: 80px;
  color: #666;
}

.info-item .value {
  flex: 1;
  color: #333;
}

.action-buttons {
  margin-top: 24px;
  text-align: center;
}
</style>
